<%@ page contentType="text/html; charset=UTF-8"%>
<%@ include file="/WEB-INF/jsp/common/init.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<jsp:include page="/WEB-INF/jsp/common/common.jsp" />
	<jsp:include page="/WEB-INF/jsp_lib/validate.jsp" />
 <script type="text/javascript">
   $(function() {
		$("#form1").validate({
			rules : {
				'mac_id' : {
					required : true
				}
			}
		});
	});
	function mysubmit() {
		var mac_id = $("select[name='mac_id']").val();
		var position = $("select[name='position']").val();
		if(mac_id!=null){
			check(mac_id,position);
		}
	}
	function check(mac_id,position){
		$.ajax({
			type:"post",
			url:"${path}/ix/seal/set/install/unique_code.htm?mac_id="+mac_id+"&position="+position,
			success:function(html){
				if("success"==html){
					ohSnap("该印控仪的该位置已使用,请重新选择！","warning");
				}else{
					$("#form1").submit();
				}
			}
		});
	}
	</script>
</head>
<body>
<jsp:include page="/WEB-INF/jsp_lib/tip.jsp" />
	<!-- 内容 -->
	<div>
		<form method="post" action="${path}/ix/seal/set/install/edit.htm" id="form1">
		<input type="hidden" name="seal_id" value="${seal._id}" />
			<h2>
				<div>
					安装
				</div>
			</h2>
			<table width="100%" class="lindex">
				<tr>
					<th align="right">
						印章名称：
					</th>
					<td align="left" >${seal.name}
					</td>
					<th align="right">
						实物编号：
					</th>
					<td align="left" >${seal.true_code}
					</td>
				</tr>
				<tr >
					<th align="right" >使用机构：</th>
					<td align="left" colspan="3">${bank.name}(${bank.code})</td>
				</tr>
				<tr>
					<th align="right">刻章字样：</th>
					<td align="left"><textarea rows="2" cols="50" readonly>${seal_new.title}</textarea></td>
					<th align="right">刻章原因：</th>
					<td align="left"><textarea rows="2" cols="50" readonly>${seal_new.desc_s}</textarea></td>

				</tr>
				
				<tr>
					<th align="right">
						备注：
					</th>
					<td align="left" colspan="3">
						<textarea  type="text" maxlength="255" rows="2" cols="60" readonly>${seal.note}</textarea>
					</td>
				</tr>
				<tr>
					<th align="right">
						印章图片：
					</th>
					<td align="left" colspan="3">
					<div id="main_pic"><img src='${path}/img/${seal.file_id}.htm?mh=150&mw=150'/></div>
					</td>
				</tr>
						<tr>
						<th align="right">印控仪</th>
						<td align="left" colspan="1">
						<select name="mac_id">
							<c:forEach items="${maclist}" var="v">
								<option value="${v._id}">${v.code}</option>
							</c:forEach>
						</select>
						</td>
						<th align="right">位置</th>
						<td align="left" colspan="3">
						<select name="position">
							<option value="位置一">位置一</option>
							<option value="位置二">位置二</option>
						</select>
						</td>
					</tr>
			</table>
				<div class="options">
					<a href="javascript:mysubmit();" class="asave" >【保存】</a>
				    <a href="javascript:goBack();" class="asave" >【返回】</a>
				</div>
		</form>
		
	</div>
</body>
</html>